package io.renren.config;

import io.renren.utils.wxpay.ConfigUtil;
import net.sf.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.gavaghan.geodesy.Ellipsoid;
import org.gavaghan.geodesy.GeodeticCalculator;
import org.gavaghan.geodesy.GeodeticCurve;
import org.gavaghan.geodesy.GlobalCoordinates;


public class Utils {
    private static final String APP_ID = ConfigUtil.getProperty("wx.appid");

    private static final String APP_SECRET = ConfigUtil.getProperty("wx.appsecret");

    private static Logger logger = LoggerFactory.getLogger(Utils.class); // 日志记录

    public static double getDistanceMeter(GlobalCoordinates gpsFrom, GlobalCoordinates gpsTo, Ellipsoid ellipsoid)
    {
        //创建GeodeticCalculator，调用计算方法，传入坐标系、经纬度用于计算距离
        GeodeticCurve geoCurve = new GeodeticCalculator().calculateGeodeticCurve(ellipsoid, gpsFrom, gpsTo);

        return geoCurve.getEllipsoidalDistance();
    }


    public static String getAccessToken(){
        String accesstoken = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="+APP_ID+"&secret="+APP_SECRET;
        JSONObject json = HttpClientUtils.httpRequest(accesstoken,"GET",null);
return null;
    }

}